<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../../common/head.jsp"%>
<script type="text/javascript">
	function pic_upload_successphoto(file, data) {
		var json = $.parseJSON(data)
		$(this).bjuiajax('ajaxDone', json)
		if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
			$('#j_custom_picphoto').val(json.filename).trigger('validate')
			$('#j_custom_span_picphoto').html('<img src="${ctx}/resource/' + json.filename + '" width="100" />')
		}
	}
	function do_OK(json, $form) {
		console.log(json)
		console.log($form)
	}
	//护照有效日期  = 签发日期 + 10年
	$('#j_custom_issuedate').on('afterchange.bjui.datepicker', function(e, data) {
		var pattern = 'yyyy-MM-dd'
		var start = end = data.value

		end.setFullYear(start.getFullYear() + 10)
		end.setDate(start.getDate() - 1)

		$('#j_custom_indate').val(end.formatDate(pattern))
	})
</script>
<%
	int labelindex = 1;
%>
<div class="bjui-pageContent">
	<form action="${ctx}/sys/update${SESSION_BEAN.role}Info.do" id="j_custom_form" data-toggle="validate"
		data-alertmsg="false">
		<table class="table table-condensed table-hover" width="100%" style="margin-top: 5px">
			<tbody>
				<c:if test="${SESSION_BEAN.role=='SimpleUser' }">
					<input type="hidden" value="${SESSION_BEAN.user.clazzId}" name="clazzId" />
					<tr>
						<td>
							<label for="j_custom_name" class="control-label x85">班级：</label>
							${SESSION_BEAN.user.clazz.name}
						</td>
					</tr>
				</c:if>
				<c:if test="${SESSION_BEAN.role=='Teacher' || SESSION_BEAN.role=='SpecUser' }">
					<input type="hidden" value="${SESSION_BEAN.user.specId}" name="specId" />
					<tr>
						<td>
							<label for="j_custom_name" class="control-label x85">系部：</label>
							${SESSION_BEAN.user.spec.name}
						</td>
					</tr>
				</c:if>
				<tr>
					<td>
						<label class="control-label x85">头像：</label>
						<div style="display: inline-block; vertical-align: middle;">
							<div id="j_custom_pic_upphoto" data-toggle="upload" data-uploader="${ctx}/com/fileUpload.do"
								data-file-size-limit="2024000000" data-file-type-exts="*.jpg;*.png;*.gif;*.mpg" data-multi="true"
								data-on-upload-success="pic_upload_successphoto" data-file-obj-name="upload" data-icon="cloud-upload"></div>
							<input type="hidden" name="photo" data-rule="required" value="${SESSION_BEAN.user.photo}" id="j_custom_picphoto">
							<span id="j_custom_span_picphoto">
								<img alt="" src="${ctx}/resource/${SESSION_BEAN.user.photo}" style="border-radius: 0.1em;" width="120px"
									onerror="javascript:this.src='${ctx}/resource/no-head.png'">
								<br />
							</span>
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_name<%=labelindex%>" class="control-label x85">账号：</label>
						<input type="text" name="uname" value="${SESSION_BEAN.user.uname}" id="j_custom_name<%=labelindex++%>"
							data-rule="required" size="15" readonly="readonly">
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_fname<%=labelindex%>" class="control-label x85">姓名：</label>
						<input type="text" name="userName" value="${SESSION_BEAN.user.userName}" id="j_custom_fname<%=labelindex++%>"
							data-rule="required" size="15">
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_sale32143rew4r23" class="control-label x85">性别：</label>
						<select name="userGender" id="j_custom_sale32143rew4r23" data-toggle="selectpicker" data-rule="required">
							<option value="女">女</option>
							<option value="男">男</option>
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_fname<%=labelindex%>" class="control-label x85">联系电话：</label>
						<input type="text" name="userPhone" value="${SESSION_BEAN.user.userPhone}" id="j_custom_fname<%=labelindex++%>"
							data-rule="mobile" size="15" maxlength="11">
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_fname<%=labelindex%>" class="control-label x85">邮箱：</label>
						<input type="text" name="userEmail" value="${SESSION_BEAN.user.userEmail}" id="j_custom_fname<%=labelindex++%>"
							data-rule="email" size="15">
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_fname<%=labelindex%>" class="control-label x85">出生日期：</label>
						<input type="text" name="userBirth" value="${SESSION_BEAN.user.userBirth}" id="j_custom_fname<%=labelindex++%>"
							data-toggle="datepicker" data-pattern="yyyy-MM-dd" readonly="readonly" size="15">
					</td>
				</tr>
				<tr>
					<td>
						<label for="j_custom_fname<%=labelindex%>" class="control-label x85">联系地址：</label>
						<input type="text" name="userAddress" value="${SESSION_BEAN.user.userAddress}"
							id="j_custom_fname<%=labelindex++%>" data-rule="" size="55">
					</td>
				</tr>
				<c:if test="${SESSION_BEAN.role=='SimpleUser' }">
					<tr>
						<td>
							<label for="question12321" class="control-label x85">密保问题：</label>
							<select name="question" id="question12321" data-toggle="selectpicker" data-rule="required">
								<option value="您目前的姓名是?">您目前的姓名是?</option>
								<option value="您配偶的生日是?">您配偶的生日是?</option>
								<option value="您的学号(或工号)是?">您的学号（或工号）是?</option>
								<option value="您母亲的生日是?">您母亲的生日是?</option>
								<option value="您高中班主任的名字是?">您高中班主任的名字是?</option>
								<option value="您父亲的姓名是?">您父亲的姓名是?</option>
								<option value="您小学班主任的名字是?">您小学班主任的名字是?</option>
								<option value="您父亲的生日是?">您父亲的生日是?</option>
								<option value="您配偶的姓名是?">您配偶的姓名是?</option>
								<option value="您初中班主任的名字是?">您初中班主任的名字是?</option>
								<option value="您最熟悉的童年好友名字是?">您最熟悉的童年好友名字是?</option>
								<option value="您最熟悉的学校宿舍舍友名字是?">您最熟悉的学校宿舍舍友名字是?</option>
								<option value="对您影响最大的人名字是?">对您影响最大的人名字是?</option>
							</select>
						</td>
					</tr>
					<tr>
						<td>
							<label for="answer" class="control-label x85">密保答案：</label>
							<input type="text" name="answer" value="${SESSION_BEAN.user.answer}" id="answer" data-rule="required" size="15">
						</td>
					</tr>
					<script type="text/javascript">
						$("#question12321").val("${SESSION_BEAN.user.question}");
					</script>
				</c:if>

			</tbody>
		</table>
	</form>
</div>
<div class="bjui-pageFooter">
	<ul>
		<li>
			<button type="button" class="btn-close" data-icon="close">取消</button>
		</li>
		<li>
			<button type="submit" class="btn-default" data-icon="save">保存</button>
		</li>
	</ul>
</div>
<script type="text/javascript">
	$("#j_custom_sale32143rew4r23").val("${SESSION_BEAN.user.userGender}");
</script>